Repeats a block of statements as long as a condition is False or until an Exit Do statement runs.
During playback, the statements in the loop run once. At the end of the first iteration, the condition is evaluated. If the condition is False, statements in the loop repeat. If the condition is True, statements in the loop do not repeat and playback continues.
Tip: Use the Do...Loop While statement to repeat a block of statements while a condition is True.
Syntax
Do
[Statements]
[Exit Do]
[Statements]
Loop Until [Condition]
You can also use this syntax:
Do Until [Condition]
[Statements]
[Exit Do]
[Statements]
Loop
Arguments
| Argument | Description |
|---|---|
| Condition | Numeric or string expression to evaluate. Null conditions are treated as False. |
| Statements | One or more statements that repeat while the condition is False. |
Note: Use the Exit statement to exit the loop and continue playback with the first statement outside of the loop.
Keyword View notes
The condition to evaluate is displayed in the Information column.
Example
productCount = Window("Feedback").ComboBox("comboboxProduct").Property("Number of Items")
counter = 1
Do
Window("Feedback").Editbox("editboxFirst").SetText("Joe")
Window("Feedback").Editbox("editboxLast").SetText("User")
Window("Feedback").ComboBox("comboboxProduct").Item(counter).Select()
Window("Feedback").Button("buttonSend").Click()
Browser().Navigate("http://www.wysicorp.com/wysicorp/reportbug.php")
counter = counter + 1
Loop Until counter >= productCount
Browser().Close()